<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> 
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script src="<c:url value="/scripts/jquery-1.4.2.js"/>" type="text/javascript" language="javascript" charset="utf-8"></script>
<script src="<c:url value="/scripts/jquery-ui-1.8.custom.min.js"/>" type="text/javascript" language="javascript" charset="utf-8"></script>
<script type="text/javascript">
function editData(){
	 var emailaddress = $("#email1").val() + "@" + $("#email2").val();	 
	 $("#emailAddress").val(emailaddress);
	 alert($("#emailAddress").val());
	 var phonenumber = $("#sell1").val() + "-" + $("#sell2").val() + "-" + $("#sell3").val();
	 $("#phoneNumber").val(phonenumber);
	 $("#upuser").submit();
};
function cutData(){
	var emailAddress = $('#emailAddress').val();
	var arr_email = emailAddress.split("@");
	alert("arr_email[0]  ::  "+arr_email[0]+" arr_email[1]  : " + arr_email[1]);
	$('#email1').val(arr_email[0]);
	$('#email2').val(arr_email[1]);

	var phoneNumber = $('#phoneNumber').val();
	var arr_phone = phoneNumber.split("-");
	alert("arr_phone[0] : "+ arr_phone[0] + " arr_phone[1] : "+ arr_phone[1]);
	$('#sell1').val(arr_phone[0]);
	$('#sell2').val(arr_phone[1]);
	$('#sell3').val(arr_phone[2]);
	
};
</script>

<body onload="cutData()">
<form:form action="#" method="POST" modelAttribute="user" id="upuser" enctype="multipart/form-data">
	<form:errors path="*" cssClass="errors"/><br/>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="84">회원정보 수정</td>
        <td width="796">
        &nbsp;
        <form:hidden path="user.username"/>
        <form:hidden path="birthDate"/>
        <form:hidden path="juminNum1"/>
        <form:hidden path="juminNum2"/>
        <form:hidden path="realName"/>
        <form:hidden path="sexDistinction"/>
        </td>
      </tr>
      <tr>
        <td class="td4a4d4a"></td>
        <td class="tde7e7e7"></td>
      </tr>
      <tr>
        <td colspan="2"><b><sec:authentication property="principal.username"/></b>님의 회원정보를 수정하는 페이지 입니다.</td>
      </tr>
      <tr>
        <td colspan="2">&nbsp;</td>
      </tr>
      
    </table>	
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="23%">&nbsp;</td>
        <td width="77%" align="right" class="font11_636563"> </td>
      </tr>
      <tr>
        <td height="37" class="tdd6d7d6_top tdfffbff LP20 font12B_4f4f4f"> <label for="nickName">닉네임 </label> </td>
        <td class="line_d6d7d6_top line_e7e7e7 LP20 font12_4f4f4f">
        <form:input path="nickName" name="textfield3" class="input" style="width:230px"/>
		<form:errors path="nickName" cssClass="errors"/>
            <span class="font11_ff6d00">(100,000콘트)</span> </td>
      </tr>
      <tr>
        <td height="37" class="tdfffbff LP20 font12B_4f4f4f"><span class="font11_636563"></span> <label for="user.password">비밀번호 </label> </td>
        <td class="line_e7e7e7 LP20">
        <form:password path="user.password" name="textfield3" class="input" style="width:230px"/>
		<form:errors path="user.password" cssClass="errors"/>
        </td>
      </tr>
      <tr>
        <td height="37" class="tdfffbff LP20 font12B_4f4f4f"><span class="font11_636563"></span> <label for="password">비밀번호 확인 </label> </td>
        <td class="line_e7e7e7 LP20">
        <form:password path="" name="textfield3" class="input" style="width:230px" id="passwordRe"/>		
        </td>
      </tr>
      <tr>
        <td height="37" class="tdfffbff LP20 font12B_4f4f4f"><label for="profilePhoto">사진 </label></td>
        <td class="line_e7e7e7 LP20" valign="middle">     		
		<input type="file" id="fileData" name="fileData" class="domainbox3_2" style="" value="${user.profilePhoto }">        
        </td>
      </tr>
      <tr>
        <td height="37" class="tdfffbff LP20 font12B_4f4f4f"><span class="font11_636563"></span> <label for="emailAddress">이메일 </label> </td>
        <td class="line_e7e7e7 LP20 font12_4f4f4f">        
        <input type="text" id="email1" name="email1" class="input" style="width:150px"/>@<input type="text" id="email2" name="email2" class="input" style="width:150px"/>
		<form:hidden path="emailAddress" id="emailAddress"/>
		<form:errors path="emailAddress" cssClass="errors"/>    
      <span class="font11_ff6d00">(100,000콘트)</span> </td>
      </tr>
      <tr>
        <td height="37" class="tdfffbff LP20 font12B_4f4f4f"><label for="phoneNumber">핸드폰 번호 </label> </td>
        <td class="line_e7e7e7 LP20 font12_4f4f4f">
        <select id="sell1" name="select2" style="width:80px">
			<option selected="selected">선택</option>
			<option value="010">010</option>
			<option value="011">011</option>
			<option value="016">016</option>
			<option value="017">017</option>
			<option value="019">019</option>
		</select>-
		<input type="text" id="sell2" name="textfield3" class="input" style="width:80px"/>-
		<input type="text" id="sell3" name="textfield3" class="input" style="width:80px"/>-
		<form:hidden path="phoneNumber" id="phoneNumber"/>
		<form:errors path="phoneNumber" cssClass="errors" />   
          </span>&nbsp;<span class="font11_ff6d00"> (100,000콘트)</span> </td>
      </tr>
      <tr>
        <td height="37" class="tdfffbff LP20 font12B_4f4f4f"><label for="address.addressInfo">주소 </label></td>
        <td class="line_e7e7e7 LP20">
        <form:input path="address.addressInfo"name="textfield3" class="input" style="width:330px"/><img src="<c:url value="/images/btn/btn_adress.gif"/>" width="53" height="22" align="absmiddle">		
		<form:errors path="address.addressInfo" cssClass="errors"/>
            <span class="font11_ff6d00"> &nbsp;(100,000콘트)</span> </td>
      </tr>
	</table>
	<table width="192" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="89"><img src="<c:url value="/images/btn/btn_ok01.gif"/>" width="60px" height="25px" border="0" onclick="editData()" style="cursor: pointer;"/>
        <td width="103"><img src="<c:url value="/images/btn/btn_cancle.gif"/>" width="60" height="25px" onClick="MM_showHideLayers('ment','','show')" style="cursor: pointer;"/></td>
      </tr>
    </table>
  		
</form:form>
</body>
